/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Boundary

import com.*
import javax.swing.*
import java.io.* 
import com.itextpdf.*
import com.itextpdf.text.pdf.CFFFont.Font
import com.itextpdf.text.Paragraph
import com.itextpdf.text.pdf.PdfPCell
import com.itextpdf.text.pdf.PdfPTable
import com.itextpdf.text.Document

/**
 *
 * @author JAVIER
 */
class Report {
    def new_report(){

      java.util.Date date = new java.util.Date();
      Font Fac = new Font(Font.getFamily("ARIAL"), 30, Font.BOLD);
      Font Title = new Font(Font.getFamily("ARIAL"), 13, Font.BOLD);
      FileOutputStream file = new FileOutputStream("C:\\hola.pdf");
      Document document = new Document();
      PdfWriter.getInstance(document, file);
      document.setMargins(72f, 72f, 72f, 72f);
      document.open();
      String fact1 = "FACTURA"+"\n"+"\n"+"\n"+"\n";
      Paragraph Fact = new Paragraph(fact1,Fac);
      document.add(Fact);
      Paragraph name  = new Paragraph("      "+"nombre"+"\n"+"\n");
      name.setAlignment(Element.ALIGN_JUSTIFIED);

      Paragraph address  = new Paragraph("      "+"direccion"+"\n"+"\n");
      PdfPTable table=new PdfPTable(3); 
      table.setWidthPercentage(100);
      PdfPCell type_table =new PdfPCell (new Paragraph("MADERA",Title));;
      PdfPCell amount_table =new PdfPCell (new Paragraph("CANTIDAD",Title));;
      PdfPCell price_table =new PdfPCell (new Paragraph("PRECIO",Title));;
      table.addCell(type_table);
      table.addCell(amount_table);
      table.addCell(price_table);
      table.addCell("TIPO");
      table.addCell("CANTIDAD");
      table.addCell("PRECIO");
           
      document.add(new Paragraph("NOMBRE:"+"\n",Title));
      document.add(name);
      document.add(new Paragraph("DIRECCION DE ENVIO:"+"\n",Title));
      document.add(address);

      document.add(table);


      document.close();
   
    }	
	
}

